package grpc

type BaseType struct {
	Name     string
	Index    int
	Type     string
	Describe string
}

func (b *BaseType) IsInt() Field {
	b.Type = "int64"
	return b
}

func (b *BaseType) IsInt64() Field {
	b.Type = "int64"
	return b
}

func (b *BaseType) IsString() Field {
	b.Type = "string"
	return b
}

func (b *BaseType) IsFloat() Field {
	b.Type = "float64"
	return b
}

func (b *BaseType) IsFloat64() Field {
	b.Type = "float64"
	return b
}

func (b *BaseType) IsBool() Field {
	b.Type = "bool"
	return b
}

func (b *BaseType) SetName(n string) Field {
	b.Name = n
	return b
}

func (b *BaseType) GetName() string {
	return b.Name
}

func (b *BaseType) SetIndex(i int) Field {
	b.Index = i
	return b
}

func (b *BaseType) GetIndex() int {
	return b.Index
}

func (b *BaseType) SetType(t string) Field {
	b.Type = t
	return b
}

func (b *BaseType) GetType() string {
	return b.Type
}

func (b *BaseType) SetDescribe(des string) Field {
	b.Describe = des
	return b
}

func (b *BaseType) GetDescribe() string {
	return b.Describe
}

type Field interface {
	SetName(n string) Field
	GetName() string
	SetIndex(i int) Field
	GetIndex() int
	SetType(t string) Field
	GetType() string
	SetDescribe(des string) Field
	GetDescribe() string
	IsInt() Field
	IsInt64() Field
	IsString() Field
	IsFloat() Field
	IsFloat64() Field
	IsBool() Field
}

func NewField(name string) Field {
	return &BaseType{
		Name: name,
	}
}
